package app

import (
	"electron/version/update/controller"
	"net/http"

	"github.com/gin-gonic/gin"
	"github.com/spf13/viper"
)

func StartRoute() {

	r := gin.Default()
	r.GET("/ping", func(c *gin.Context) {
		c.JSON(http.StatusOK, gin.H{
			"message": "pong",
		})
	})
	r.GET("/check_version", controller.CheckVersion)
	r.GET("/download_version", controller.UpdateVersion)
	r.Run(viper.GetString("server.host") + ":" + viper.GetString("server.port")) // listen and serve on 0.0.0.0:8080 (for windows "localhost:8080")
}
